Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed ~str pattern #12756

Closed
wants to merge 1 commit into from
Closed

Removed ~str pattern #12756

wants to merge 1 commit into from

Conversation

pongad
Copy link
Contributor

@pongad pongad commented Mar 7, 2014

match-drop-strs-issue-4541.rs deleted as it's the same with issue-4541.rs

@huonw
Copy link
Member

huonw commented Mar 7, 2014

Can we have a longer commit message? e.g. explaining a bit about why this is disappearing.

@pongad
Copy link
Contributor Author

pongad commented Mar 8, 2014

Updated.

@alexcrichton
Copy link
Member

The commit message isn't quite accurate. To the best of my knowledge we will never get matching on ~str ever again, even in a post-DST world.

This is the commit message that I was thinking of:

rustc: Remove matching on ~str from the language

The `~str` type is not long for this world as it will be superseded by the
soon-to-come DST changes for the language. The new type will be
`~Str`, and matching over the allocation will no longer be supported.
Matching on `&str` will continue to work, in both a pre and post DST world.

cc @pcwalton

@pongad
Copy link
Contributor Author

pongad commented Mar 9, 2014

I was talking to eddyb over the IRC and that's the impression I got. Of course, I might have just misunderstood him. I'll update the commit message once we get confirmation from @pcwalton

The `~str` type is not long for this world as it will be superseded by the
soon-to-come DST changes for the language. The new type will be
`~Str`, and matching over the allocation will no longer be supported.
Matching on `&str` will continue to work, in both a pre and post DST world.
@pongad
Copy link
Contributor Author

pongad commented Mar 12, 2014

@alexcrichton Changed commit message and rebased!

bors added a commit that referenced this pull request Mar 13, 2014
match-drop-strs-issue-4541.rs deleted as it's the same with issue-4541.rs
@bors bors closed this Mar 13, 2014
@pongad pongad deleted the remove_owned_str_pat branch March 13, 2014 05:59
Kroisse added a commit to Kroisse/rust-mustache that referenced this pull request Mar 17, 2014
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jun 27, 2024
…xendoo

Avoid emitting `assigning_clones` when cloned data borrows from the place to clone into

Fixes rust-lang#12444
Fixes rust-lang#12460
Fixes rust-lang#12749
Fixes rust-lang#12757
Fixes rust-lang#12929

I think the documentation for the function should describe what- and how this is fixing the issues well.
It avoids emitting a warning when the data being cloned borrows from the place to clone into, which is information that we can get from `PossibleBorrowerMap`. Unfortunately, it is a tiny bit tedious to match on the MIR like that and I'm not sure if this is possibly relying a bit too much on the exact MIR lowering for assignments.

Things left to do:
- [x] Handle place projections (or verify that they work as expected)
- [x] Handle non-`Drop` types

changelog: [`assigning_clones`]: avoid warning when the suggestion would lead to a borrow-check error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants